<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<canvas id="canvas" width="500px" height="500px"></canvas>
<script>
    //获取画布DOM对象
    var canvas = document.getElementById('canvas');
    //获取画笔（获取上下文）
    var ctx = canvas.getContext('2d');
    //声明开始绘制路径
    ctx.beginPath();
    //移动到这个点
    ctx.moveTo(50, 50);
   //结束声明
    ctx.closePath();

</script>
</body>
</html>
